 /*
 * @description: 店铺数据/查看报名次数
 * @Author: along
 * @Date: 2021-05-24
 * @Last Modified by: along
 * @Last Modified time: 2021-05-27
 */
<template>
    <el-dialog
        title="获得报名次数"
        :visible.sync="dialogVisible"
        width="476px"
        :close-on-click-modal="false"
        class="__model"
    >
        <div class="__table">
            <el-table
                :data="tableData"
                height="100%"
                style="width: 100%"
                class="data-table"
            >
                <el-table-column
                    prop="status"
                    label="获得类型"
                    show-overflow-tooltip
                    :formatter="emptyFormatter"
                    align="center"
                >
                    <template slot-scope="scope">
                        {{ scope.row.title }}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="count"
                    label="成功报名商品数量"
                    show-overflow-tooltip
                    :formatter="emptyFormatter"
                    align="center"
                >
                    <template slot-scope="scope">
                        {{ scope.row.count }}件
                    </template>
                </el-table-column>
                <el-table-column
                    prop="times"
                    label="成功报名次数"
                    show-overflow-tooltip
                    :formatter="emptyFormatter"
                    align="center"
                >
                    <template slot-scope="scope">
                        {{ scope.row.times }}次
                    </template>
                </el-table-column>
            </el-table>
        </div>
    </el-dialog>
</template>

<script>
export default {
    name: 'CheckApplyNumber',
    data () {
        return {
            dialogVisible: false,
            tableData: []
        };
    },
    methods: {
        /**
         * @description 显示弹窗
         */
        show (row) {
            this.tableData = row.activity_list.reduce((cur,next) => {
                cur.push({
                    title: next.title,
                    count: next.goods_success_count,
                    times: next.goods_success_times
                });
                return cur;
            }, []);
            this.dialogVisible = true;
        },

        /**
         * @description 关闭弹窗
         */
        close () {
            this.dialogVisible = false;
        },

        /**
         * @description 过滤函数
         */
        emptyFormatter(row, column, val) {
            if (!val) return '--';
            return val;
        }
    }
};
</script>

<style lang="less" scoped>
.__table {
    width: 100%;
    max-height: 424px;
    overflow: hidden;
    overflow-y: auto;
    box-sizing: border-box;
    border-left: 1px solid #EBEEF5;
    border-right: 1px solid #EBEEF5;
}
.pagination-wrapper {
    padding: 0px 24px;
    border: 1px solid #EBEEF5;
    display: flex;
    align-items: center;
    height: 56px;
    border-top: none;
    justify-content: flex-end;
    .el-pagination {
        float: right;
        padding: 0;
        background-color: transparent;
    }
}
</style>